import { TableBase, TextTable } from '@/components/public-template';
import { Api } from '@/config/api/archivesFileInventory';

class IndexService {
  getTables() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'folderName',
        value: '盘点范围'
      }),
      new TextTable({
        key: 'storageLocationCode',
        value: '盘点位置'
      }),
      new TextTable({
        key: 'boxCode',
        value: '档案盒'
      }),
      new TextTable({
        key: 'typeName',
        value: '档案类型'
      }),
      new TextTable({
        key: 'filesBoxCode',
        value: '档案编码'
      }),
      new TextTable({
        key: 'name',
        value: '文件名称'
      }),
      new TextTable({
        key: 'code',
        value: '文件编码'
      }),
      new TextTable({
        key: 'filePages',
        value: '文件页数'
      }),
      new TextTable({
        key: 'retentionPeriodDate',
        value: '保管期限',
        type: 'dictionary',
        state: {
          filterName: 'DMS_ARCHIVES_FILE_LIST_RETENTION_PERIOD_DATE'
        }
      }),
      new TextTable({
        key: 'inventoryResult',
        value: '盘点结果',
        type: 'dictionary',
        state: {
          filterName: 'PASS_OR_NO'
        },
        colors: {
          2: '#FF4D4F'
        }
      }),
      new TextTable({
        key: 'resultExplain',
        value: '说明'
      }),
      new TextTable({
        key: 'exceptionHandling',
        value: '异常处理',
        type: 'dictionary',
        state: {
          filterName: 'EXCEPTION_HANDLER'
        }
      })
    ];
    return tables;
  }
  getNormalTables() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'folderName',
        value: '盘点范围'
      }),
      new TextTable({
        key: 'storageLocationCode',
        value: '盘点位置'
      }),
      new TextTable({
        key: 'boxCode',
        value: '档案盒'
      }),
      new TextTable({
        key: 'typeName',
        value: '档案类型'
      }),
      new TextTable({
        key: 'filesBoxCode',
        value: '档案编码'
      }),
      new TextTable({
        key: 'name',
        value: '文件名称'
      }),
      new TextTable({
        key: 'code',
        value: '文件编码'
      }),
      new TextTable({
        key: 'filePages',
        value: '文件页数'
      }),
      new TextTable({
        key: 'retentionPeriodDate',
        value: '保管期限',
        type: 'dictionary',
        state: {
          filterName: 'DMS_ARCHIVES_FILE_LIST_RETENTION_PERIOD_DATE'
        }
      }),
      new TextTable({
        key: 'inventoryResult',
        value: '盘点结果',
        type: 'dictionary',
        state: {
          filterName: 'PASS_OR_NO'
        },
        colors: {
          2: '#FF4D4F'
        }
      }),
      new TextTable({
        key: 'resultExplain',
        value: '说明'
      })
    ];
    return tables;
  }
  getIcons(billId) {
    const icons: TableBase<any>[] = [
      new TextTable({
        key: 'download',
        value: '导出',
        type: 'primary',
        class: 'icon-download',
        state: {
          type: 'all',
          url: Api.inventoryExportErrorList,
          postType: 'get',
          params: { billId },
          urlName: 'billId',
          fileName: '盘点异常清单.xlsx'
        }
      })
    ];
    return icons;
  }
  getNormalIcons(billId) {
    const icons: TableBase<any>[] = [
      new TextTable({
        key: 'download',
        value: '导出',
        type: 'primary',
        class: 'icon-download',
        state: {
          type: 'all',
          url: Api.inventoryExportNormalList,
          postType: 'get',
          params: { billId },
          urlName: 'billId',
          fileName: '盘点正常清单.xlsx'
        }
      })
    ];
    return icons;
  }
}

export default new IndexService();
